<?php
	class loginControl extends Control{
		function index(){
			if ($this->rbac_is_login()) {
            	go("index/index");
        	}
			$this->display();
		}
	    function login() {
	        if ($this->rbac_user_login($_POST['username'], md5($_POST['password']), "admin")) {
	        	$db = M("user");
	        	$time=time();
		        $db->logintime=$time;
		        $db->uid = $_SESSION["user"];
		        $db->loginip=ip_get_client();
		        $db->save();
		        $_SESSION['loginip']=ip_get_client();
		        $_SESSION['logintime']=$time;
	            go("index/index");
	        }   
	        $this->error($this->error, "index");
	    }
	    function quit() {
	        session_unset();
	        session_destroy();
	        $this->success("退出成功","login/index");
    	}
	}












?>